<template>
	<view>
		<view class="mp-header">
			<view class="sys-head" :style="{ height: statusBarHeight+'px;' }"></view>
			<view class="serch-box" style="height: 43px;">
				<view class="serch-wrapper">
					<view class="logo skeleton-rect">
						<image :src="logoPath" mode="heightFix"></image>
					</view>
				</view>
			</view>
		</view>
		<view :style="'height:'+marTop+'px;'"></view>
	</view>
</template>

<script>
	let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
	export default {
		name: 'indexHeader',
		props: {

		},
		data() {
			return {
				statusBarHeight: statusBarHeight,
				marTop: 0,
				logoPath: '/static/img/logoIndex.png',
			};
		},
		mounted() {
			let that = this;
			setTimeout(() => {
				// 获取小程序头部高度
				let info = uni.createSelectorQuery().in(this).select(".mp-header");
				info.boundingClientRect(function(data) {
					that.marTop = data.height
				}).exec()
			}, 100)
		},
		methods: {

		}
	}
</script>

<style lang="scss">
	/* #ifdef MP || APP-PLUS */
	.mp-header {
		z-index: 30;
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;

		// background: linear-gradient(90deg, $bg-star 50%, $bg-end 100%);


		.serch-wrapper {
			height: 100%;
			padding: 0 220rpx 0 32rpx;
			display: flex;
			align-items: center;

			.logo {
				height: 60rpx;
				margin-right: 30rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.input {
				flex: 1;
				height: 50rpx;
				padding: 0 0 0 30rpx;
				background: rgba(247, 247, 247, 1);
				border: 1px solid rgba(241, 241, 241, 1);
				color: #BBBBBB;
				font-size: 28rpx;

				.iconfont {
					margin-right: 20rpx;
				}

				// 没有logo，直接搜索框
				&.on {
					/* #ifdef MP */
					width: 70%;
					/* #endif */
					/* #ifdef APP-PLUS */
					width: 100%;
					/* #endif */
				}

				// 设置圆角
				&.fillet {
					border-radius: 29rpx;
				}

				// 文本框文字居中
				&.row-center {
					padding: 0;
				}
			}
		}
	}

	/* #endif */
</style>
